package drongo.desktop.window
{
	import flash.utils.Dictionary;

	public class WindowManager
	{
		public function WindowManager()
		{
			
		}
		private static var windowMap:Dictionary=new Dictionary();
		public static function register(key:String,window:Class):void{
			windowMap[key]=window;
		}
		public static function unregister(key:String):void{
			delete windowMap[key];
		}
		/**
		 * 打开一个窗口 
		 * @param key
		 * @param data
		 */
		public static function call(key:String,data:Object=null):void{
			var windowClass:Class=windowMap[key];
			if(!windowClass){
				throw new Error("未找到："+key+"窗口类，请先调用WindowManager.register来注册");
			}
			var window:DGNativeWindow=new windowClass();
			window.data=data;
			window.open();
		}
	}
}